import React from 'react'
import { Table } from 'antd'
import Paging from 'components/common/paging'

function ObjectList({ objectInfo, objectColumns, handleChangePage }) {
  // 分页器
  const handlePageChange = (page) => {
    handleChangePage(page)
  }
  return (
    <>
      <Table
        columns={objectColumns}
        dataSource={objectInfo && objectInfo.records ? objectInfo.records : []}
        pagination={false}
        bordered={true}
        className="self-table"
        rowKey={record => record.id}
      />
      <Paging
        total={objectInfo && objectInfo.total ? objectInfo.total : 0}
        pageSize={objectInfo && objectInfo.size}
        handlePageChange={handlePageChange}
        pageCount={objectInfo && objectInfo.current}
        pages={objectInfo && objectInfo.pages}
      ></Paging>
    </>
  )
}

export default ObjectList
